package org.jianfa.rpc.consumer;

import org.jianfa.learn.common.service.IUserService;
import org.jianfa.rpc.consumer.client.RpcConsumer;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SimpleRpcConsumerApplication {

    public static void main(String[] args) throws Exception{
        //1.创建代理对象
        IUserService service = (IUserService) RpcConsumer.createProxy(IUserService.class);

        //2.循环给服务器写数据
        while (true){
            String result = service.sayHello("are you ok !!");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            String date = sdf.format(new Date());
            System.out.println(date + " : " + result);
            Thread.sleep(2000);
        }
    }
}
